package com.glo.spreadsheet2db.model;

import java.io.Serializable;

public class SpreadsheetCell implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6444061763621360852L;
	
	private long id;
	private String value;
	private int columnIndex;
	private int rowIndex;
	
	private long sheetId;
	
	private Spreadsheet spreadsheet;
	
	public SpreadsheetCell(long id, String value, int columnIndex, int rowIndex, long sheetId) {
		super();
		this.id = id;
		this.value = value;
		this.columnIndex = columnIndex;
		this.rowIndex = rowIndex;
		this.sheetId = sheetId;
	}

	public SpreadsheetCell(String value, int columnIndex, int rowIndex) {
		this(-1, value, columnIndex, rowIndex, -1);
	}

	public long getId() {
		return id;
	}
	
	public void setId(long id) {
		this.id = id;
	}

	public String getValue() {
		return value;
	}

	public int getColumnIndex() {
		return columnIndex;
	}

	public int getRowIndex() {
		return rowIndex;
	}

	public long getSheetId() {
		if( spreadsheet != null ) {
			sheetId = spreadsheet.getId();
		}
		return sheetId;
	}

	public void setSheetId(long sheetId) {
		this.sheetId = sheetId;
	}
	
	public void setSheet(Spreadsheet sheet) {
		this.spreadsheet = sheet;
	}
	
}
